#include <string>

#include "../WasmString.h"
#include "../WasmData.h"

namespace TW::Wasm {

class <%= WasmCppHelper.class_name(entity: entity) %> {
<% if not entity.is_struct -%>
  public:
    TW<%= entity.name %> *instance;
  public:
    <%= WasmCppHelper.class_name(entity: entity) %>(TW<%= entity.name %> *instance) : instance(instance) {}
<%  unless entity.methods.select{ |x| x.name == "Delete" }.empty? -%>
    ~<%= WasmCppHelper.class_name(entity: entity) %>() {
        TW<%= entity.name %>Delete(instance);
    }
<%  end -%>
<% end -%>
  public:
<%# Constructors -%>
<%  entity.static_methods.each do |method| -%>
<%    next if method.name.start_with?('Create') || method.name.start_with?('Init') -%>
    static auto <%= WasmCppHelper.function_name(entity: entity, function: method) %>(<%= WasmCppHelper.parameters(method.parameters) %>);
<%  end -%>
<%# Properties -%>
<%  entity.static_methods.each do |method| -%>
<%    next unless method.name.start_with?('Create') -%>
    static auto <%= WasmCppHelper.function_name(entity: entity, function: method) %>(<%= WasmCppHelper.parameters(method.parameters) %>) -> <%= WasmCppHelper.class_name(entity: entity) %>*;
<%  end -%>
<%- entity.properties.each do |property| -%>
    auto <%= WasmCppHelper.format_name(property.name) %>();
<%- end -%>
<%# Methods -%>
<% entity.methods.each do |method| -%>
<%   next if method.name == "Delete" -%>
    auto <%= WasmCppHelper.format_name(method.name) %>(<%= WasmCppHelper.parameters(method.parameters.drop(1)) %>);
<% end -%>
}; // class <%= entity.name %>

} // namespace TW::Wasm
